<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            /* animation: perspectiveChange 3s linear infinite alternate-reverse; */
            perspective: 500px;
            display: flex;
        }

        /* @keyframes perspectiveChange {
            from {
                perspective: 100px;
            }

            to {
                perspective: 500px;
            }
        } */

        .box {
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
            /* perspective: 500px; */
            /* transition: all 2s; */
            transform-style: preserve-3d;
            animation: rotateYY 3s linear infinite;
        }

        @keyframes rotateYY {
            from {
                transform: rotateY(0)
            }

            to {
                transform: rotateY(360deg)
            }
        }

        .box div {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: pink;
        }

        .box div:last-child {
            background-color: purple;
            animation: rotateXX 1s linear infinite alternate;
        }

        @keyframes rotateXX {
            from {
                transform: rotateX(45deg);
            }

            to {
                transform: rotateX(135deg);
            }
        }

        .flip {
            position: relative;
            width: 300px;
            height: 300px;
            margin: 100px auto;
            transition: all 6s;
            transform-style: preserve-3d;
        }

        .flip:hover {
            transform: rotateY(180deg);
        }

        .front,
        .back {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            text-align: center;
            line-height: 300px;
            font-size: 40px;
            font-weight: 600;
        }

        .front {
            background-color: pink;
            backface-visibility: hidden;
            z-index: 1;
        }

        .back {
            background-color: blueviolet;
            transform: rotateY(-180deg);
        }
    </style>
</head>

<body>
    <!-- css 3d基本展示 -->
    <div class="box">
        <div></div>
        <div></div>
    </div>
    <!-- 两面翻转的盒子 -->
    <div class="flip">
        <div class="front">黑马程序员</div>
        <div class="back">我在这里等你</div>
    </div>
</body>

</html>